From: Carlos Soriano Date: Fri, 19 Sep 2014 17:25:35 +0000 (+0200) Subject: iconGrid: Fix slowness on pulse animation for few items X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~2042 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=d0de411a59761273d3aab9fec864aa3c29a0dbc9;p=gnome-shell.git iconGrid: Fix slowness on pulse animation for few items Currently we use the same amount of total delay divided by all items, but that makes the items animate slow if the amount of items is small. To avoid that, use a smaller total amount delay for an amount of items smaller than four. https://bugzilla.gnome.org/show_bug.cgi?id=737017 --- diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js index a35489b61..875450191 100644 --- a/js/ui/iconGrid.js +++ b/js/ui/iconGrid.js @@ -20,6 +20,7 @@ const EXTRA_SPACE_ANIMATION_TIME = 0.25; const ANIMATION_TIME_IN = 0.350; const ANIMATION_TIME_OUT = 1/2 * ANIMATION_TIME_IN; const ANIMATION_MAX_DELAY_FOR_ITEM = 2/3 * ANIMATION_TIME_IN; +const ANIMATION_BASE_DELAY_FOR_ITEM = 1/4 * ANIMATION_MAX_DELAY_FOR_ITEM; const ANIMATION_MAX_DELAY_OUT_FOR_ITEM = 2/3 * ANIMATION_TIME_OUT; const ANIMATION_FADE_IN_TIME_FOR_ITEM = 1/4 * ANIMATION_TIME_IN; @@ -429,13 +430,20 @@ const IconGrid = new Lang.Class({ return; } + // For few items the animation can be slow, so use a smaller + // delay when there are less than 4 items + // (ANIMATION_BASE_DELAY_FOR_ITEM = 1/4 * + // ANIMATION_MAX_DELAY_FOR_ITEM) + let maxDelay = Math.min(ANIMATION_BASE_DELAY_FOR_ITEM * actors.length, + ANIMATION_MAX_DELAY_FOR_ITEM); + for (let index = 0; index < actors.length; index++) { let actor = actors[index]; actor.reactive = false; actor.set_scale(0, 0); actor.set_pivot_point(0.5, 0.5); - let delay = index / actors.length * ANIMATION_MAX_DELAY_FOR_ITEM; + let delay = index / actors.length * maxDelay; let bounceUpTime = ANIMATION_TIME_IN / 4; let isLastItem = index == actors.length - 1; Tweener.addTween(actor,